package com.ibeeking.gmc.global.g.rest.controller.v1;

import com.ibeeking.gmc.global.service.common.param.TenantLegalInfoParam;
import com.ibeeking.gmc.global.service.common.vo.TenantLegalInfoVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName TenantLegalInfoController
 * @Description
 * @Author ibeeking
 * @Date 2020-12-24 16:34
 **/
@RestController
@RequestMapping("/g/legalinfo/v1")
public class TenantLegalInfoController {

    @Resource
    private com.ibeeking.gmc.global.g.rest.service.ITenantLegalInfoService ITenantLegalInfoService;


    @Log(logType = OperateLogTypeEnum.SAVE, describe = "新增法人信息")
    @PostMapping(value = "/add")
    public Boolean add(@RequestBody @Validated TenantLegalInfoParam tenantLegalInfoParam) {
        return ITenantLegalInfoService.save(tenantLegalInfoParam);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改法人信息")
    @PostMapping(value = "/modify")
    public Boolean modify(@RequestBody @Validated TenantLegalInfoParam tenantLegalInfoParam) {
        return ITenantLegalInfoService.save(tenantLegalInfoParam);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询法人详细信息")
    @PostMapping(value = "/view/{id}")
    public TenantLegalInfoVO view(@PathVariable("id") Long id) {
        return ITenantLegalInfoService.view(id);
    }


    @Log(logType = OperateLogTypeEnum.DEL, describe = "删除法人信息")
    @PostMapping(value = "/del/{id}")
    public Boolean del(@PathVariable("id") Long id) {
        return ITenantLegalInfoService.del(id);
    }
}